package io.renren.modules.area_region.entity;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

import org.apache.commons.lang.StringUtils;
import org.phprpc.util.PHPSerializer;

public class Feedata {
	private String shipping_id;
	private String fee;
	private String time;
	private String shipping_name;
	
	private String desc;
	private String message;
	
	
	
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public String getShipping_id() {
		return shipping_id;
	}
	public void setShipping_id(String shipping_id) {
		this.shipping_id = shipping_id;
	}
	public String getFee() {
		return fee;
	}
	public void setFee(String fee) {
		this.fee = fee;
	}
	public String getTime() {
		return time;
	}
	public void setTime(String time) {
		this.time = time;
	}
	public String getShipping_name() {
		return shipping_name;
	}
	public void setShipping_name(String shipping_name) {
		this.shipping_name = shipping_name;
	}
	@Override
	public String toString() {
		return "Feedata [shipping_id=" + shipping_id + ", fee=" + fee + ", time=" + time + ", shipping_name="
				+ shipping_name + "]";
	}
	
	public static String serializeToString(Object obj)  {
		ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
		ObjectOutputStream objOut;
		String str = null;
		try {
			objOut = new ObjectOutputStream(byteOut);
			objOut.writeObject(obj);
			str = byteOut.toString("ISO-8859-1");// 此处只能是ISO-8859-1,但是不会影响中文使用
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return str;
	}
	
	public static Feedata getUnserialize(String content) {
		PHPSerializer p = new PHPSerializer();
		if (StringUtils.isEmpty(content))
			return null;
		Feedata t = null;
		try {
			t = (Feedata) p.unserialize(content.getBytes(), Feedata.class);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return t;
	}
	
}
